Section 3.6.3.5.1
Light Attenuation

Light attenuation is used to model the decrease in light intensity as the light travels through a translucent object. Its syntax is:

finish { fade_distance FADE_DISTANCE fade_power FADE_POWER }

The fade_distance keyword determines the distance the light has to travel to reach half intensity while the fade_power keyword describes how fast the light will fall off. For realistic effects a fade power of 1 to 2 should be used.

The attenuation is calculated by a formula similar to that used for light source attenuation.

                                 1
  attenuation = --------------------------------------
                 1 + (d / FADE_DISTANCE) ^ FADE_POWER

Section 3.6.3.5.2
Faked Caustics

The syntax is:

finish { caustics POWER }

***FIX ME***


Section 3.6.3.6
Iridescence

The syntax is:

finish { irid { AMOUNT thickness FLOAT turbulence VECTOR } }

Iridescence, or Newton's thin film interference, simulates the effect of light on surfaces with a microscopic transparent film overlay The effect is like an oil slick on a puddle of water or the rainbow hues of a soap bubble (see also "irid_wavelength" ).

This finish modifies the surface's color as a function of the angle between the light source and the surface. Since the effect works in conjunction with the position and angle of the light sources to the surface, it does not behave in the same ways as a procedural pigment pattern.

The "amount" parameter is the contribution of the iridescence effect to the overall surface color. As a rule of thumb, keep to around 0.25 (25% contribution) or less, but experiment. If the surface is coming out too "white", try lowering the diffuse and possibly the ambient values of the surface.

The "thickness" parameter represents the film's thickness. This is an awkward parameter to set, since the thickness value has no relationship to the object's scale. Changing it affects the scale, or "busy-ness" of the effect. A very thin film will have a high frequency of color changes, where a thick film will have large areas of color.

The thickness of the film can be varied with the special turbulence parameter. You can only specify turbulence amount with iridescence. The octaves, lambda, and omega values are internally set and are not adjustable by the user at this time.

In addition, perturbing the object's surface-normal through the use of bump patterns will affect iridescence.

[*** This may be better off in povray.doc -dmf] For the curious, thin film interference occurs because, when the ray hits the surface of the film, part of the light is reflected from that surface, while a portion is transmitted into the film. This "subsurface" ray travels through the film and eventually reflects off the opaque substrate. The light emerges from the film slightly out of phase with the ray that was reflected from the surface.

This phase shift creates interference, which varies with the wavelength of the component colors, resulting in some wavelengths being reinforced, while others are cancelled out. When these components are recombined, the result is iridescence.

The concept used for this feature came from the book Fundamentals of Three-Dimensional Computer Graphics, by Alan Watt (Addison-Wesley).


Section 3.6.4
Halo

A halo is used to simulate some of the atmospheric effects that occur when small particles interact with light or radiate on their own. Those effects include clouds, fogs, fire, etc.

Halos are attached to an object, the so called "container object", which they completely fill. If the object is partially or completely translucent and the object is specified to be hollow (see "Hollow" for more details) the halo will be visible. Thus the halo effects are limited to the space that the object covers. This should always be kept in mind.

What the halo actually will look like depends on a lot of parameters. First of all you have to specify which kind of effect you want to simulate. After this you need to define the distribution of the particles. This is basically done in two steps: a mapping function is selected and a density function is chosen. The first function maps world coordinates space onto a one-dimensional interval while the later describes how this linear interval is mapped onto the final density values.

The properties of the particles, such as their color and their translucency, are given by a color map. The density values calculated by the mapping processes are used to determine the appropriate color using this color map.

A ray marching process is used to volume sample the halo and to accumulate the intensities and opacity of each interval.

The following sections will describe all of the halo parameters in more detail. The complete halo syntax is given by:

halo { attenuating | emitting | glowing | dust [ constant | linear | cubic | poly ] [ planar_mapping | spherical_mapping | cylindrical_mapping | box_mapping ] [ dust_type DUST_TYPE ] [ eccentricity ECCENTRICITY ] [ max_value MAX_VALUE ] [ exponent EXPONENT ] [ samples SAMPLES ] [ aa_level AA_LEVEL ] [ aa_threshold AA_THRESHOLD ] [ jitter JITTER ] [ turbulence <TURBULENCE> ] [ octaves OCTAVES ] [ omega OMEGA ] [ lambda LAMBDA ] [ colour_map COLOUR_MAP ] [ frequency FREQUENCY ] [ phase PHASE ] [ scale <VECTOR> ] [ rotate <VECTOR> ] [ translate <VECTOR> ] }

***FIX ME*** (A lot may be missing here.) [DB]


Section 3.6.4.1
Halo Type

The type of the halo is defined by one of the following mutually exclusive keywords (if more than one is specified the last will be used). The default is "attenuating".

halo { attenuating | emitting | glowing | dust }

The halo type determines how the light will interact with the particles inside the container object. There are two basic categories of light interaction: self-illuminated and illuminated. The first type includes the "attenuating", "emitting", and "glowing" effects while the "dust" effect is of the second type.

Those four types will be covered in detail in the next sections.

***FIX ME*** [DB]


Section 3.6.4.1.1
Attenuating

The attenuating halo, that only absorbs light passing through it, is rendered by accumulating the particle density along a ray. The total halo color is determined from the total, accumulated density and the specified color map (see "Halo Color Map" for details about the color map). The background light, i.e. the light passing through the halo, is attenuated by the total density and added to the total halo color to get the final color of the halo.

This model is suited to render particle distributions with a high "albedo" because the final color does not depend on the transparency of single volume elements but only on the total transparency along the ray. The albedo of a particle is given by the amount of light scattered by this particle in all directions in relation to the amount of incoming light. If the particle doesn't absorb any light the albedo is one.

Clouds and steams are two of the effects that can be rendered quite realistic by adding enough turbulence.

***FIX ME*** [DB]


Section 3.6.4.1.2
Dust

The dust halo consists of particles that do not emit any light. They only reflect and absorb incoming light. Its syntax is:

halo { dust [ dust_type DUST_TYPE ] [ eccentricity ECCENTRICITY ] }

As the ray marches through the dust all light coming from any light sources is accumulated and scattered according to the dust type and the current dust density. Since this light accumulation includes a test for occlusion, other objects may cast shadows "into" the dust.

The same scattering types that are used with the atmosphere in "Atmosphere" can be used with the dust (the default type is isotropic scattering). They are:

#declare ISOTROPIC_SCATTERING = 1 #declare MIE_HAZY_SCATTERING = 2 #declare MIE_MURKY_SCATTERING = 3 #declare RAYLEIGH_SCATTERING = 4 #declare HENYEY_GREENSTEIN_SCATTERING = 5

The Henyey-Greenstein function needs the additional parameter "eccentricity" that is describe in the section about atmosphere.

***FIX ME*** [DB]


Section 3.6.4.1.3
Emitting

Emitting halos only emit light. Every particle is a small light source that emits some light. This light is not attenuated by the other particles because they are assumed to be very small.

As the ray travels through the density field of an emitting halo the color of the particles in each volume element and their differential transparency is determined from the color map. These intensities are accumulated to get the total color of the density field. This total intensity is added to the light passing through the halo. The background light is attenuated by the total density of the halo.

Since the emitted light is not attenuated it can be used to model effects like fire, explosions, light beams, etc. By choosing a well suited color map those effects can be rendered with a high degree of realism.

Fire is best modeled using planar mapping. Spherical mapping and high turbulence values can be used to create explosions (it's best to use a periodic color map and frequencies larger than one).

Emitting halos do not cast any light on other objects like light sources do, even though they are made up of small, light-emitting particles. In order to make them actually emit light hundreds or thousands of small light sources would have to be used. This would slow down tracing by a degree that would make it useless.

***FIX ME*** [DB]


Section 3.6.4.1.4
Glowing

The glowing halo is similar to the emitting halo. The difference is that the light emitted by the particles is attenuated by the other particles. This can be seen as a combination of the attenuating and the emitting model.

***FIX ME*** [DB]


Section 3.6.4.2
Density Mapping

The density mapping is used to map points in space onto a linear, one-dimensional interval between 0.0 and 1.0. The different mapping types are specified by (the default is planar mapping):

halo { planar_mapping | spherical_mapping | cylindrical_mapping | box_mapping }

Since the mapping takes place in relation to the coordinate center/axis/plane the following rule should be noticed: Halo container objects should be unit sized objects centered at the origin. They can be transformed later to suit the individuals needs.

***FIX ME*** [DB]


Section 3.6.4.2.1
Box Mapping

The maximum of the absolute values of each coordinate given by

r(x, y, z) = max(abs(x), abs(y), abs(z))

is used to get the interval values. Values larger than one are clipped to one.

***FIX ME*** [DB]


Section 3.6.4.2.2
Cylindrical Mapping

The distance r(x, y, z) from the y-axis given by

r(x, y, z) = sqrt(x*x + z*z)

is used to get the interval values. Values larger than one are clipped to one.

***FIX ME*** [DB]


Section 3.6.4.2.3
Planar Mapping

The distance r(x, y, z) from the x-z-plane given by

r(x, y, z) = abs(y)

is used to get the interval values. Values larger than one are clipped to one.

***FIX ME*** [DB]


Section 3.6.4.2.4
Spherical Mapping

The distance r(x, y, z) from the origin given by

r(x, y, z) = sqrt(x*x + y*y + z*z)

is used to get the interval values. Values larger than one are clipped to one.

***FIX ME*** [DB]


Section 3.6.4.3
Density Function

The density function determines how the actual density values are calculated from the linear, one-dimensional interval that the density mapping gave. It is specified by the following keywords:

halo { [ constant | linear | cubic | poly ] [ max_value MAX_VALUE ] [ exponent EXPONENT ] }

The individual functions f(r) are described in the following sections. They all map the value r(x, y, z) calculated by the density mapping onto a suitable density range between 0 and MAX_VALUE (specified with the keyword "max_value").

***FIX ME*** [DB]


Section 3.6.4.3.1
Constant

The constant function gives the constant value MAX_VALUE regardless of the interval value after the density mapping. Its formula is:

f(r) = MAX_VALUE

***FIX ME*** [DB]


Section 3.6.4.3.2
Linear

A linear falloff from MAX_VALUE at r=0 to 0 at r=1 can be realized with the linear function. It is given by:

f(r) = MAX_VALUE * (1 - r)

***FIX ME*** [DB]


Section 3.6.4.3.3
Cubic

The cubic function gives a smooth blend between the maximum value MAX_VALUE at r=0 and 0 at r=1. It is given by:

f(r) = MAX_VALUE * (2 * r - 3) * r * r + 1

This is actually a cubic spline.

***FIX ME*** [DB]


Section 3.6.4.3.4
Poly

A polynomial function can be used to get a great variety of density functions. All have the maximum value MAX_VALUE at r=0 and the minimum value 0 at r=1. It is given by:

f(r) = MAX_VALUE * (1 - r) ^ EXPONENT

The exponent is given by the "exponent" keyword. In case of EXPONENT=0 you'll get a linear falloff.

***FIX ME*** [DB]


Section 3.6.4.4
Halo Color Map

The density f(r), which ranges from 0.0 to MAX_VALUE, is mapped onto the color map to get the color and differential translucency for each volume element as the ray marches through the density field (for more details about the color mapping see "Halo Type" ). The differential translucency determines for each value of f(r) how much the total opacity has to be increased (or decreased).

The color map is specified by:

halo { [ colour_map COLOUR_MAP ] }

The differential translucency is stored in the transmittance channel of the map's color entries. A simple example is given by

colour_map { [0 rgbt<1, 1, 1, 1>] [1 rgbt<1, 1, 1, 0>] }

In this example areas with a low density (small f(r)) will be translucent (large differential translucency) and areas with a high density (large f(r)) will be opaque (small differential translucency).

There is no default color map.

***FIX ME*** [DB]


Section 3.6.4.5
Halo Sampling

The halo effects are calculated by marching through the density field along a ray. At discrete steps samples are taken from the density field and evaluated according to the color map and all other parameters. The effects of all volume elements are accumulated to get the total effect.

The following parameters are used to tune the sampling process:

halo { [ samples SAMPLES ] [ aa_level AA_LEVEL ] [ aa_threshold AA_THRESHOLD ] [ jitter JITTER ] }

The individual sampling parameters are described in the sections below.

***FIX ME*** [DB]


Section 3.6.4.5.1
Number of Samples

The number of samples that are taken along the ray inside the halo container object is specified by the "samples" keyword. The greater the number of samples the more denser the density field is sampled along the ray and the more accurate, but slower the result will be.

The default number of samples is 10. This is sufficient for simple density fields that don't use turbulence.

High turbulence values and dust halos normally need a large number of samples to avoid aliasing artifacts.

***FIX ME*** [DB]


Section 3.6.4.5.2
Supersampling

The sampling is prone to alias (like the atmosphere sampling in "Atmosphere" ). One way to reduce possible aliasing artifacts is to use supersampling. If two neighboring samples differ too much an additional sampling is taken in-between. This process recurses until the samples are close too each other (i.e. the values of the samples, not their distance) or the maximum recursion level given by AA_LEVEL is reached. The threshold to kick supersampling in is given by AA_THRESHOLD.

By default supersampling is not used. The default values for AA_THRESHOLD and AA_LEVEL are 0.3 and 3.

***FIX ME*** [DB]


Next Section
Table Of Contents